<%@ page import="java.sql.*"%>

	<%
	
	response.setContentType("application/vnd.ms-excel"); 
	Connection con=null;
	PreparedStatement sst=null;
	Statement st=null;
	ResultSet rs=null;
 %>
<% String ihtml="<html><head>";
   ihtml+="<meta http-equiv=\"page-enter\" content=\"blendTrans(duration=1)\">";
   ihtml+="<meta http-equiv=\"Pragma\" content=\"no-cache\">";
   ihtml+="<meta http-equiv=\"expires\" content=\"0\">";
   
   ihtml+="<title>Cyber Shopping Terminal</title>";
   ihtml+="</head><body>";
   ihtml+="<style>";
   ihtml+=".padd {width:10%;padding-left:8px; }";
   ihtml+=".report {border:1px solid gray; padding:5px; font-family:tahoma; font-weight:bold;font-size:12px; color:lightslategray; width:500px; }";
   ihtml+="</style><BR>";
   String buff="";
   String head="";
   String cmd;
    try {
   	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	con=DriverManager.getConnection("jdbc:odbc:bug","bug","bug");
    st=con.createStatement();
    rs=st.executeQuery("select * from bugs order by bugid");
	head+="<table align=center width=700 cellspacing=1 cellpadding=2 bgcolor=lightslategray>";
	head+="<tr bgcolor=lightslategray><th style='color:aliceblue'>BugId</th><th style='color:aliceblue'>Bug Name</th><th style='color:aliceblue'>Raised Date</th><th style='color:aliceblue'>Priority</th><th style='color:aliceblue'>Status</th></tr>";
	int count=0;
	String qty,tot;
	String price;
	Date raisedDate;
	String bugId,bugName,priority,desc,status;
	while(rs.next()) {
		
        bugId=rs.getString(1);
		bugName=rs.getString(2);
        raisedDate=rs.getDate(4);
		priority=rs.getString(6);
		
		status=rs.getString(8);
		buff+="<TR bgcolor=whitesmoke>";
		buff+="<TD align=center>"+bugId+"</td>";
		buff+="<TD align=center>"+bugName+"</td>";
		buff+="<TD align=center>"+raisedDate+"</td>";
		buff+="<TD align=center>"+priority+"</td>";
		buff+="<TD align=center>"+status+"</td>";
		//buff+="<TD class=padd>"+qty+"</td>";
		//buff+="<TD class=padd>"+tot+"</td>";
		//buff+="<TD class=padd>"+odate+"</td>";
		buff+="</TR>";

	}
	
	
	
		out.println(head+buff+"</table>");
		out.println(ihtml);
        out.println("<fieldset><legend>View All BugsReports Terminal</legend><BR>"+head+buff+"</table><BR></fieldset>");
	
	
	} catch(Exception e) {
		e.printStackTrace();
		String msg=e.getMessage().toString();
		String toprint=msg.substring(msg.lastIndexOf(":"));
		out.println(ihtml+"<center><div class=report><font color=green>Error Occured Due to The"+toprint+"</font></div></center>"); }
%>

